import axios from "./request";
//配置接口地址

function get(url, params) {
  return new Promise((resolve, reject) => {
    axios.get(url, {
      params
    }).then(response => {
      resolve(response)
    }, error => {
      reject(error)
    })
  })
}

function post(url, params) {
  return new Promise((resolve, reject) => {
    axios.post(url, params
    ).then(response => {
      resolve(response.data)
    }, error => {
      reject(error)
    })
  })
}

function exportFile(url, params) {
  return new Promise((resolve, reject) => {
    axios.get(url, {
      params: params,
      responseType: 'blob'
    }).then(response => {
      resolve(response)
    }, error => {
      reject(error)
    })
  })
}


export {
  get,
  post,
  exportFile
}